import json

import requests


def generateConfiguration(idrac_ip):
    idrac_ip1 = '20.12.95.32'
    systemID_url = "https://" + idrac_ip1 + "/redfish/v1/Systems/System.Embedded.1"
    members_url = "https://" + idrac_ip1 + "/redfish/v1/UpdateService/FirmwareInventory"
    header = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36'
    }
    auths = ('root', 'calvin')
    response_system_id = requests.get(systemID_url, auth=auths, headers=header, verify=False)
    response_members = requests.get(members_url, auth=auths, headers=header, verify=False)
    response_members.encoding = 'UTF-8'
    response_system_id.encoding = 'UTF-8'
    response_members_data = json.loads(response_members.text)
    response_system_id_data = json.loads(response_system_id.text)
    result = {}

    result['SystemID'] = response_system_id_data['Oem']['Dell']['DellSystem']['SystemID']
    result['Members'] = response_members_data['Members']
    return json.dumps(result)
